package cn.lili.eventbus;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

/**
 * @Author Sylow
 * @Description 事件总线服务（替代RocketMQ）
 * @Date: Created in 17:11 2025/6/12
 */
@Service
public class EventBusService implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher eventPublisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.eventPublisher = applicationEventPublisher;
    }

    /**
     * 发布事件
     */
    public void publishEvent(Object event) {
        eventPublisher.publishEvent(event);
    }

}
